package com.cloudcc.mobile.dao.impl;

import com.cloudcc.cloudframe.net.RequestListener;
import com.cloudcc.cloudframe.net.async.JsonObjectRequest;
import com.cloudcc.cloudframe.util.GsonUtil;
import com.cloudcc.mobile.dao.BaseEngine;
import com.cloudcc.mobile.dao.EntityEngine;
import com.google.gson.JsonArray;
import com.google.gson.JsonObject;
import com.loopj.android.http.RequestParams;

public class EntityEngineImpl extends BaseEngine implements EntityEngine {

	@Override
	public void deleteEntity(String id, String objectApiName,
			RequestListener requestListener) {
		JsonArray jsonArray = new JsonArray();
		JsonObject jsonObject = new JsonObject();
		jsonObject.addProperty("id", id);
		jsonArray.add(jsonObject);
		RequestParams params = new RequestParams();
		params.add("data", GsonUtil.Object2Json(jsonArray));
		params.add("objectApiName", objectApiName);
		JsonObjectRequest request = new JsonObjectRequest();
		request.setRequestListener(requestListener);
		sendPost(params, "deleteWithRoleRight", request);
	}

}
